<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="{$CSS}bootstrap.min.css">
<link rel="stylesheet" href="{$CSS}admin.css">
<title>我的活动</title>
</head>
<body>

    <div class="tb-toolbar">
		<div class="span8 control-group">
		<a href="indexadd.html" class="btn btn-small btn-primary">新增</a>
		<button class="btn btn-small"  id="del">删除</button>
		</div>
		<div class="span4" style="text-align:right;">
		<form action=""  class="form-horizontal form-validate">
						{$tj->text('name','class="input-large" placeholder="请输入名称" ')}
			<button class="btn">查询</button>
		</form>
		</div>
	</div>

	<table class="table table-bordered">
			<thead>
				<tr>
					<th style="width:10px;"><input type="checkbox" onclick="selallck(this);"></th>
					<th>活动名称</th>
					<th>关键字</th>
					<th>活动时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			{loop $res as $r}			 
			      <tr>
						<td>
						<input type="checkbox"  value="{$r->id}">
						</td>
						<td>{$r->name}</td>
						<td>{$r->gjz}</td>
						<td>
						{$r->kssj}-{$r->jssj}
						</td>
						<td>
						<span>
						[
						<a href="indexadd-{$r->id}.html">修改</a>
						]
						</span>
						<span>
						[
						<a href="javascript:;" onclick="dellbs('index',{$r->id},this)">删除</a>
						]
						</span>
						</td>
						
				  </tr>
			{/loop}
			</tbody>
		</table>
<script  type="text/javascript">
function dellbs(controlName,id,o){
	if(id=='a'){
		var ids = [];
		$('td').find('input[type="checkbox"]:checked').each(function(){
			ids[ids.length] = $(this).val();
		});
		if(ids.length == 0){
			alert('请选择要删除的选项');
	        return false;
		}else{
		if(confirm('确定删除这些信息吗？')){
			ajax(controlName+'-del.html',{ id:ids.join(',')},function(){
				$('td').find('input[type="checkbox"]:checked').each(function(){
					$(this).parent().parent().remove();
				});
			});	
		}
	}
	}else{
		if(confirm('确定删除此条信息吗？')){
			ajax(controlName+'-del.html',{ id:id},function(){
				$(o).parent().parent().parent().remove();
			});	
		}
	}	
}
</script>
</body>

</html>